﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using NavKet.Models;

namespace NavKet.Controllers
{
    public class ItemController : Controller
    {
        //
        // GET: /Item/
        MallEntities1 navKetEntity = new MallEntities1();
        public ActionResult Index(long id)
        {

           VW_ItemDetails itemDetails = navKetEntity.SelectVWItemDetailsByItemId(id).SingleOrDefault();
           ViewBag.MallName = itemDetails.MallName;
           ViewBag.ShopName = itemDetails.ShopName;
           ViewBag.DepartmentName = itemDetails.DepartmentName;
           ViewBag.ItemName = itemDetails.ItemName;
           ViewBag.MallId = itemDetails.MallID;
           ViewBag.ShopId = itemDetails.shopId;
           ViewBag.ItemId = itemDetails.ItemId;
           ViewBag.DepartmentID = itemDetails.DepartmentId;
            List<string>ItemImages= navKetEntity.SelectItemImagesByItemID(id).Select(x=>x.ImgName).ToList();
            ViewBag.MainImage = "main.jpg";
            ViewBag.ItemImages = ItemImages;
            return View(itemDetails);
        }
      


    }
}
